/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef INPUTEVENT_H
#define INPUTEVENT_H

#include <string>

namespace liba
{
namespace input
{

class Event
{
	enum state_enum { RELEASE, PRESS, TEXT };
public:
	Event()
	{}
	Event( const std::string & hardware_name, const std::string & key_name, bool pressed, double time = 0 );
	Event( const std::string & hardware_name, const std::wstring & text, double time = 0 );
	Event( const std::string & hardware_name, const std::string & key_name, double value, double time = 0 );

	void change_info(const std::string & new_hardware_name, const std::string & new_key_name );
	const std::string & get_hardware_name()const
	{
		return hardware_name;
	}
	const std::string & get_key_name()const
	{
		return key_name;
	}
	const std::wstring & get_text()const
	{
		return text;
	}
	bool is_pressed()const
	{
		return state == PRESS;
	}
	bool is_released()const
	{
		return state == RELEASE;
	}
	bool is_text()const
	{
		return state == TEXT;
	}
	double get_time()const
	{
		return time;
	}
	double get_value()const
	{
		return value;
	}

	bool operator==(const Event & event)const;
	bool operator!=(const Event & event)const
	{
		return !operator==( event );
	}
private:
	std::string hardware_name;
	state_enum state;
	std::string key_name;
	std::wstring text;
	double value;
	double time;
};

} // namespace input
} // namespace liba
using namespace liba;


#endif //INPUTEVENT_H